TARGET = fft

CC = gcc
LD = gcc

SRCDIR   = src
INCDIR   = -I include
BUILDDIR = build

CFLAGS = -Wall -O2 $(INCDIR)

SRC = $(foreach dir, $(SRCDIR), $(wildcard $(dir)/*.c))
OBJ = $(addprefix $(BUILDDIR)/, $(patsubst %.c, %.o, $(notdir $(SRC))))

.PHONY: ALL DIR clean

ALL : DIR $(BUILDDIR)/$(TARGET).exe
	@echo Done.

DIR :
	-mkdir $(BUILDDIR)

$(BUILDDIR)/$(TARGET).exe : $(OBJ)
	$(LD) -o $@ $^

$(BUILDDIR)/%.o : $(SRCDIR)/%.c
	$(CC) $(CFLAGS) -c -o $@ $<

clean:
	@del $(BUILDDIR)\*.exe
	@del $(BUILDDIR)\*.o
	@echo Done.